package com.zhixi.pattern.important.singletonpattern.operation;

/**
 * 懒汉式（多线程效率低）
 *
 *
 * @作者 ShuHaoNan
 * @邮箱 shuhaonan1@gmail.com
 * @时间 2020/11/15 9:33
 */
public class Singleton4 {

    private static Singleton4 instance;

    private Singleton4() {}

    // 多线程
    public static synchronized Singleton4 getInstance() {
        if (instance == null) {
            instance = new Singleton4();
        }
        return instance;
    }

}
